<template>
  <div class="privacy-container">
    <!-- <div class="page-header">
      <div class="container">
        <div class="header-content">
          <h1>{{ policyData.description }}</h1>
          <p>最后更新时间：{{ policyData.updatedTime }}</p>
        </div>
      </div>
    </div> -->
    <div class="container">
      <div class="content">
        <div v-html="policyData.settingValue"></div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted, watch } from "vue";
import { useRoute } from "vue-router";
import { privacyApi } from "@/api/user";
const policyData = ref({
  settingValue: "",
  description: "",
  updatedTime: "",
});
const route = useRoute();
const getData = async () => {
  let res = "";
  if (route.query.type == "visitorTerms") {
    res = await privacyApi.getVisitorTerms();
  } else if (route.query.type == "visitorPrivacy") {
    res = await privacyApi.getVisitorPrivacyPolicy();
  } else if (route.query.type == "footerTerms") {
    res = await privacyApi.getFooterTerms();
  } else {
    res = await privacyApi.getFooterPrivacyPolicy();
  }
  if (res.code == "200") {
    policyData.value = res.data;
  }
};
watch(
  () => route.query.type,
  () => {
    getData();
  }
);
onMounted(() => {
  console.log(route.query);
  getData();
});
</script>
<style scoped>
.page-header {
  height: 300px;
  color: white;
  background: linear-gradient(
    195deg,
    var(--e-global-color-a3699a4) 0%,
    var(--e-global-color-5c1ca3d) 100%
  );
}
.container {
  height: 100%;
}

.header-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}
.header-content p {
  font-size: 14px;
  color: #999;
}
.content {
  padding: 20px;
}
</style>
